_Pragma("once");

#include <cstdint>
#include <utility>
#include <memory>


enum LoopStatus: char {
    OFF = 0,
    ON = 1,

    /**
     * 手动状态 关
     */
    AUTO_OFF = 48,
    /**
     * 手动模式持续时间
     */
    AUTO_ON = 48 + 1,
    /**
     * 手动状态 关
     */
    MANUAL_OFF = 48 + 2,
    /**
     * 手动状态 开
     */
    MANUAL_ON = 48 + 3,
    /**
     * 定时器状态 关
     */
    TIMER_OFF = 48 + 4,
    /**
     * 定时器状态 开
     */
    TIMER_ON = 48 + 5,
    /**
     * 光控状态
     */
    LIGHT_INTENSITY = 48 + 6,
    /**
     * 错误
     */
    ERROR = 48 + 7,


    NO_BACKUP_STATUS = 'A',
    NEXT_MANUAL_STATUS = 'B',

};



enum LedColor : int8_t {
    CLOSE =0x0
    , RED = 0x1
    , GREEN = 0x2
    , BLUE = 0x3
    , YELLOW = 0x4
    , PINK = 0x5
    , CYAN_BLUE = 0x6
    , WHITE = 0x7
};



inline LedColor getColorByCommand(const LoopStatus& loopStatus) {
    LedColor result = LedColor::CLOSE;
    switch (loopStatus) {
    case AUTO_OFF: {
        result =  LedColor::PINK;
    }
    break;

    case AUTO_ON: {
        result =  LedColor::BLUE;
    }
    break;

    case MANUAL_ON: {
        result =  LedColor::GREEN;
    }
    break;

    case MANUAL_OFF: {
        result =  LedColor::RED;
    }
    break;

    case TIMER_OFF: {
        result =  LedColor::YELLOW;
    }
    break;

    case TIMER_ON: {
        result =  LedColor::CYAN_BLUE;
    }
    break;

    case ERROR: {
        result =  LedColor::CLOSE;
    }
    break;

    default: {
        result =  LedColor::CLOSE;
    }
    break;

    }
    return result;
}


typedef std::unique_ptr<LoopStatus[]>  LoopStatusArrayUniPtr;


/*
inline std::string buildCommandString(const LoopStatus* const command, size_t length, std::string& output){
    const LoopStatus* pEnd = command + length;

    for(const LoopStatus* pStatus = command; pStatus != pEnd; ++pStatus){
        output += BINARY_TO_CHAR(*pStatus);
    }

    return output;
}
*/



















